Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

middie

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

middie

Middleware engine for Fastify

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
46K
decreased by-27.8%
Maintainers
1
Weekly downloads
 
Created
Source

middie

js-standard-style Build Status

middie is the module that add middlewares support on steroids to Fastify.

The syntax style is the same as express/connect.
Does not support the full syntax middleware(err, req, res, next), because error handling is done inside Fastify.

If you want to see how use this module with Fastify, check here.

Install

npm install middie --save

Usage

const Middie = require('middie')
const http = require('http')
const helmet = require('helmet')
const cors = require('cors')

const middie = Middie(_runMiddlewares)
middie.use(helmet())
middie.use(cors())

http
  .createServer(function handler (req, res) {
    middie.run(req, res)
  })
  .listen(3000)

function _runMiddlewares (err, req, res) {
  if (err) {
    console.log(err)
    res.end(err)
    return
  }

  // => routing function
}

Acknowledgements

This project was kindly sponsored by nearForm.

License

Licensed under MIT.

Keywords

FAQs

Package last updated on 11 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc